<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

</body>
<script src="./MyPromise.js"></script>
<script>
  // let promise = new MyPromise((resolve, reject) => {
  //   // setTimeout(() => {
  //     // resolve('成功')
  //   // }, 2000)
  //   reject('失败')
  // })
  // promise.then().then().then(console.log, console.log)

  let p1 = new MyPromise((resolve, reject) => {
    setTimeout(() => {
      resolve(100)
    }, 2000)
  })
  let p2 = new MyPromise((resolve, reject) => {
    resolve(200)
  })
  // MyPromise.all([p1, p2]).then(console.log)
  // MyPromise.resove(100).then(console.log)
  p2.finally(() => {
    console.log('finally')
    return p1;
  }).then(console.log)

  var arr = [12, 34, 32, 89, 4];
  console.log(Math.min(...arr))
  var a = 10;
var obj = {
  a: 20,
  fn() {
    setTimeout(function() {
      console.log('a',this.a)
    })
  }
}
obj.fn()
</script>
</html>
